/**
 * Created by lijing on 2016-06-22.
 */
$(document).ready(function () {

    $("#idSubmit").click(function (e) {
        savePub();
    });

    $("#parentName").click(function () {
        $("#parentName").cate({
            title: "父类",
            url: G_Path.path + "/user/cate/level",
            liveSearch: false,
            param: {
                "type": ""
            },
            "id": "parentId",
            "name": "parentName"
        });
    });

});

function savePub() {
    $.post(G_Path.path + "/user/cate/save", $("#mainForm").serialize(), function (text) {
        var data = $.parseJSON(text);
        if (data.success) {
            if ("view" == status) {
                history.back();
            } else {
                window.close();
            }
        } else {
            showDialogMessage(data.msg);
        }
    });
}